package com.xxl.job.executor.service.jobhandler;

import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.spring.starter.JobParam;
import com.xxl.job.spring.starter.WebConsoleLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class MySampleXxlJob {
    private static Logger logger = LoggerFactory.getLogger(MySampleXxlJob.class);


    @XxlJob("simpleTest")
    public void simpleTest(@JobParam("currentTime") String time) throws Exception {
        WebConsoleLog.info("当前时间为：{}", time);
    }


    @XxlJob(value = "simpleTest2", init = "init", destroy = "destroy")
    public void demoJobHandler2() throws Exception {
        WebConsoleLog.info("XXL-JOB, Hello World.");
    }

    public void init() {
        logger.info("init");
    }

    public void destroy() {
        logger.info("destroy");
    }


}
